package me.jiatao.mvpdagger2;

import android.util.Log;
import android.view.View;

import java.util.List;

import me.jiatao.mvpdagger2.ioc.DaggerNewsComponent;
import me.jiatao.mvpdagger2.ioc.NewsModule;
import me.jiatao.mvpdagger2.mvc.base.BaseMVPActivity;
import me.jiatao.mvpdagger2.mvc.news.INewsContract;
import me.jiatao.mvpdagger2.mvc.news.NewsPresenter;

public class Main2Activity extends BaseMVPActivity<NewsPresenter> implements INewsContract.INewsView {

    @Override
    protected void setContentView() {
        setContentView(R.layout.activity_main2);
    }

    @Override
    protected void injectPresenter() {
        DaggerNewsComponent
                .builder()
                .newsModule(new NewsModule(this))
                .build()
                .inject(this);
    }

    @Override
    public void onNewsSucceed(List<String> newsList) {
        Log.i("***onNewsSucceed***", newsList.toString());
    }

    public void getNewsList(View view) {
        getPresenter().getNewsList();
    }
}
